#!/bin/bash

# 读取主机名
read -p "Please enter your host name: " HOST_NAME

# 安装常用工具 编译器
yum install -y gcc gcc-c++ make ntp vim-enhanced perl 

# 系统最大句柄限制
ulimit -n 8192

# 语言编码
if [ -e /etc/sysconfig/i18n ]; then
     sed -i '/^LANG=/{s/LANG=.*/LANG="zh_CN.UTF-8"/}' /etc/sysconfig/i18n
else
     echo LANG="zh_CN.UTF-8" > /etc/sysconfig/i18n
fi

# shell提示符样式
echo "export PS1='[\\u@\\h \\W]\\$ '" >> /etc/profile

# 时区及时间
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
ntpdate 210.72.145.44

# 主机名设置
hostname ${HOST_NAME}
sed -i "/^HOSTNAME=/{s/HOSTNAME=.*/HOSTNAME=\"${HOST_NAME}\"/}" /etc/sysconfig/network
sed -i '/^NETWORKING_IPV6=/{s/NETWORKING_IPV6=.*/NETWORKING_IPV6=no/}' /etc/sysconfig/network
echo 1 >/proc/sys/net/ipv4/ip_forward
cat >> /etc/hosts <<EOF
127.0.0.1      ${HOST_NAME}
EOF

